#!/bin/bash
# Currently I cross-check data generation in Gecko and WebKit, then populate
# using the WebKit copy because it has fewer bugs to fix.  This fixes the bugs
# for me.  Must be run from the root of the spec repo.
set -e
cd conformancetest
fromdos webkit-data
fromdos gecko-data
# Take a diff, ignoring the first two lines (which will contain dates).  This
# reflects the differences in tests between Gecko and WebKit.  If any new tests
# don't match between Gecko and WebKit, I want to know about it.
diff -u webkit-data gecko-data | tail -n +3 > tmp-diff
# Compare the diffs.  If they differ, other than just line numbers, it will
# exit with a nonzero exit code, so set -e will cause the script to abort,
# printing out the difference.  It will need to be manually reviewed to
# identify why there's a new difference between WebKit and Gecko.
diff -u -I ^@@ diff tmp-diff
rm tmp-diff
# The file "diff" contains the differences from WebKit to Gecko.  The file
# "patch" is a manually-crafted subset, which contains only the differences
# where we actually want Gecko's output.  Thus we copy webkit-data to data.js,
# then apply patch so that it has the parts of Gecko's output we want instead
# of WebKit's.
cp webkit-data data.js
patch data.js patch
